package cn.caplike.demo.consistence.threadpool.and.blockingqueue.context.service;

import cn.caplike.demo.consistence.threadpool.and.blockingqueue.context.entity.Inventory;

/**
 * @author LiKe
 * @version 1.0.0
 * @date 2020-03-18 16:00
 */
public interface InventoryService {

    /**
     * Description: 获取 Redis 中的 KEY
     *
     * @return java.lang.String
     * @author LiKe
     * @date 2020-03-18 16:03:48
     */
    static String getKey(String key) {
        return "inventory:key:" + key;
    }

    /**
     * Description: 删除 Redis 中对应 KEY 的缓存
     *
     * @return java.lang.Boolean
     * @author LiKe
     * @date 2020-03-18 16:06:38
     */
    Boolean removeCache(String key);

    void saveCache(Inventory inventory);

    Inventory getCache(String key);

    Inventory selectById(String id);

    void update(Inventory inventory);

    /**
     * Description: 设置空值在缓存中的失效时间
     *
     * @return void
     * @author LiKe
     * @date 2020-03-18 16:12:05
     */
    void saveNullForCache(String inventoryKey, long expireTime);
}
